import request from '@/utils/request'

export function add_trigger(name, expression, desc, enable, level, host_id, template_id) {
  return request({
    url: '/trigger/info',
    method: 'post',
    data: {
      name,
      expression,
      desc,
      enable,
      level,
      host_id,
      template_id
    }
  })
}

export function change_trigger(name, expression, desc, enable, level, trigger_id, host_id, template_id) {
  return request({
    url: '/trigger/info',
    method: 'put',
    data: {
      name,
      expression,
      desc,
      enable,
      level,
      trigger_id,
      host_id,
      template_id
    }
  })
}

export function trigger_list(param) {
  return request({
    url: '/trigger/list',
    method: 'get',
    params: param
  })
}

export function read_trigger(param) {
  return request({
    url: '/trigger/info',
    method: 'get',
    params: param
  })
}

export function change_trigger_status(id, status) {
  return request({
    url: '/trigger/status',
    method: 'put',
    data: { id, status }
  })
}

export function delete_trigger(param) {
  return request({
    url: '/trigger/info',
    method: 'delete',
    params: param
  })
}
